<?php if (!defined('THINK_PATH')) exit();?><table id="zds_my_dg"></table>
<style>
    .uploadpic{
        float:left;
        width: 295px;
        text-align:center;
        height:165px;
    }
    .uploadpic h3{
        text-align:left;
        border:1px solid  #95B8E7;
        float:left;
        padding:4px;
        background-color:#95B8E7;
        color:#FFF;
    }
    .up-content{
        border:1px solid  #95B8E7;
        padding:4px;
    }
    .w10{
        float:left;
        width:10px;
        color:#FFF;
    }
    .items{
        padding:10px 0 4px 0;
        border-top: solid 1px #D6D4D4;
        display: block;
    }
    #dd div{
        padding-right: 10px;
        padding-bottom: 10px;
    }
    .addItems{
        float: left;
    }


    .add_table{
        width:100%;
    }
    .add_table th{
        width:140px;
        background-color: #E0ECFF;
        padding: 8px 0 8px 0;
        border-right:solid 1px #95B8E7;
        border-bottom: solid 1px #95B8E7;
    }
    .add_table td{
        border-bottom: solid 1px #95B8E7;
    }
    .add_table tr{
        border:solid 1px #95B8E7;
    }
    .tb_head{
        text-align: center;
        padding: 10px;
        background-color: #E0ECFF;
        font-size: 20px;
        font-weight: bold;
    }
    .inline{
        display:inline
    }
    .row_container{
        padding:8px 5px 5px 5px;
    }
    .add_label{
width:82px;
display:-moz-inline-box; /* css注释：for ff2 */ 
display:inline-block; 
    }


    .uploadify-button {
      background-color: #A0D468;
    background-image: none;
    color: #FFF;
    font-size: 14px;
    padding: 2px 15px;

    border: none;
}
.uploadify-button:hover{
color:#FFF;
background-color: #f0ad4e;
background-image: none;
}
.uploadify-queue{
    width:50%;
}
.uploadify-progress{
    width:95%;
}
.textbox textarea.textbox-text {
white-space: pre-wrap;
}

</style>
<div id="myzdstool">    

<table>
<tr>
<!-- 	<td>
		<?php if(authCheck1('Home/Zds/add')): ?><a href="#" id= "aaa1" class="easyui-linkbutton"  onclick='show_add_zds()' data-options="iconCls:'icon-standard-folder-page',plain:true">添加</a><?php endif; ?>
	    <?php if(authCheck1('Home/Zds/del')): ?><a href="#" class="easyui-linkbutton"  onclick='dele_zds()' data-options="iconCls:'icon-standard-page-white-delete',plain:true">删除</a><?php endif; ?>
	    <?php if(authCheck1('Home/Zds/edit')): ?><a href="#" class="easyui-linkbutton"  onclick='show_edit_zds()' data-options="iconCls:'icon-standard-application-edit',plain:true">编辑</a><?php endif; ?>
	</td>
	<?php if(authCheck1('Home/Zds/add,Home/Zds/del,Home/Zds/edit',1,1,'and')): ?><td>
	    	<div class="datagrid-btn-separator"></div>
		</td><?php endif; ?> -->
	<td>
	<!-- 	<?php if(authCheck1('Home/Quality/out')): ?><a href="#"  class="easyui-linkbutton"   onclick="excel()" data-options="iconCls:'icon-standard-page-white-excel',plain:true">导出</a><?php endif; ?> -->
	        <a href="#" class="easyui-linkbutton"  onclick="viewZds()" data-options="iconCls:'icon-standard-application-view-gallery',plain:true">查看</a> 
	 
	</td>
	<td>
    	<div class="datagrid-btn-separator"></div>
	</td>    
   	<td>
	  <a href="#" class="easyui-linkbutton"  onclick="reloadZds()" data-options="iconCls:'icon-standard-arrow-refresh',plain:true">刷新</a> 
   	</td>
	<td>
	     <div class="datagrid-btn-separator"></div>
	</td>
   <td>
     	<div style="float:right;">        
               <input  id='search_zds_box' class="easyui-searchbox" data-options="" style="width:400px;"/>
			   </div>
			  
			      
			   <div id="mm_zds" style="width:400px">
			    <div data-options="name:'content',iconCls:'icon-standard-table-edit',selected:true">全局搜索</div>

	<div data-options="name:'title',iconCls:'icon-standard-table-edit'">名称</div>
		<div data-options="name:'ids',iconCls:'icon-standard-table-edit'">编号</div>
        <div data-options="name:'nickname',iconCls:'icon-standard-table-edit'">作者</div>

</div>
	   </td>
	   	 <td>
     <div class="datagrid-btn-separator"></div>
 </td>
 	 <td>
       <a href="#" id="finaZdsBtn" class="easyui-linkbutton"  onclick="finaSearchZds()" data-options="iconCls:'icon-search',plain:true">显示高级搜索</a>
 </td>
</tr>

</table>
<!-- 全局搜索 -->

    

<table  id="finaBoxZds" style="display:none;">
<tr >
<td style="padding:0px 0px 0px 5px" colspan="5">
   <div class="table-btn-separator"></div>
</td>
</tr>
	<tr>
		<td>
			  <div class="finaSeDiv">
        <label for="name">编号:</label>
        <input class="easyui-textbox" type="text" name="ids" id="f_ids" style="width:130px" />
    </div>
		</td>
		<td>
			 <div class="finaSeDiv">
        <label for="name">名称:</label>
        <input class="easyui-textbox" type="text" name="title" id="f_title" style="width:130px" />
    </div>
		</td>
		<td>
			<div class="finaSeDiv">
        <label for="name">车间:</label>

 <input id="f_cj" name="cj" class="easyui-textbox" data-options="iconCls:'',editable:true,panelHeight:'auto'"  style="width:130px" />

     
    </div>
		</td>
		<td>
			 <div class="finaSeDiv">
        <label for="name">工位:</label>

<select id="f_gw" class="easyui-combobox" name="gws" style="width:130px;">   

</select>  
       
 <!-- <input id="f_gw" name="gws" class="easyui-textbox" data-options="iconCls:'',editable:true,panelHeight:'auto'"  style="width:130px" /> -->
    </div>
		</td>
         <td>
        <div class="finaSeDiv">
        <label for="name">车型/配置:</label>
        <input class="easyui-textbox" type="text" name="cx" id="f_cx" style="width:130px" />
    </div>
        </td>
      


        
	</tr>
	<tr>
       <td>
        <div class="finaSeDiv">
        <label for="name">分组:</label>

         <input id="ffz_edit" class="easyui-combogrid" data-options="" name="fz[]" style="width:120px;"/>

    </div>
        </td>
<td>
	<div>
        <label for="name">作者:</label>
        <input class="easyui-textbox" type="text" name="nickname" id="f_nickname" style="width:130px" />
    </div>
		</td>


	
		
		<td colspan="2">

		
			<div class="finaSeDiv2">
        <label for="name">日期:</label>

        <input  name="creatdates" id="f_creatdates"   type= "text" class= "easyui-datebox" style="width:100px"/>  到  
         <input  name="creatdatee" id="f_creatdatee"   type= "text" class= "easyui-datebox" style="width:100px"/>
  
        <a id="finSerBtn" href="#" onclick="finaZds()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>
    </div>
		</td>
	</tr>
</table>




</div>

<!-- 编辑窗口 -->
<div id="editZds" class="easyui-dialog" style="width:870px; height: 541px; padding: 0px; overflow: hidden;" title="编辑作业指导书" data-options="iconCls:'icon-standard-folder-page',buttons:'#dlg-add',closed:true,resizable:true,modal:true,closable:true">
    <form id="editZds_form"  enctype="multipart/form-data" method="post" >
    <input type="hidden" name="id" id="id_edit">
    <table class="add_table">
        <tr>
        <th>上传作业指导书</th>
        <td>
            <div class="row_container" style="background: #FFFEE6;">
                <div class="inline" id="urlspan">
                    <input  name="urledit" id="new_url" style="width:450px;"  class="easyui-filebox" data-options="buttonText:'上传作业指导书',buttonIcon:'icon-standard-application-edit',accept:'application/pdf'">

                </div>

            </div>
        </td>
    </tr>
    <tr>
    <th>文件信息</th>
        <td style="background-color:rgba(204, 204, 204, 0.4);">
            <div class="row_container">
                <div class="inline">
                    <span class="add_label">编号：</span>
                    <input id="edit_ids" name="ids" class="easyui-textbox" data-options="iconCls:'',editable:false,required:true"   style="width:150px" />
                </div>
                <div class="inline">
                    <span class="add_label">名称：</span>
                     <input id="edit_title" name="title" class="easyui-textbox" data-options="iconCls:'',editable:true,required:true"   style="width:381px" />
                </div>
           
            </div>
           
            
        </td>
    </tr>
    <tr>
        <th>装配单位</th>
        <td>
            <div class="row_container">
                <div class="inline">
                    <span class="add_label">车间：</span>
                    <input id="cj_edit" name="cj" class="easyui-textbox" data-options="iconCls:'',editable:true,required:true,panelHeight:'auto'"  style="width:150px" />
                </div>
                 <div class="inline">
                    <span class="add_label">工位：</span>                
                     <input id="gw_edit" class="easyui-combogrid" data-options="editable:false,required:true" name="gw[]" style="width:300px;"/>
                </div>

            
           
            </div>
        </td>
    </tr>
    <tr>
        <th>其他信息</th>
        <td>
           <div class="row_container">
                <div class="inline">
                    <span class="add_label">适用车型/配置:</span>
                    <input id="edit_cx" name="cx" class="easyui-textbox" data-options="iconCls:'',editable:true,required:true"   style="width:150px" />
                </div>
            <div class="inline">
                    <span class="add_label">分组：</span>                
                     <input id="fz_edit" class="easyui-combogrid" data-options="editable:false,required:true" name="fz[]" style="width:300px;"/>
                </div>
           
            </div>
        </td>
    </tr>
   <tr>
        <th>文本化</th>
        <td>
           <div class="row_container">
                
                <textarea name="content" class="easyui-textbox" id="edit_content" style="width: 100%; height: 300px;"  data-options="required:true,multiline:true,prompt:'请将作业指导书所有内容以文本格式粘贴进此文本框，文本化目的是为了更好的进行查询！'"></textarea>
                    
        
           
            </div>
        </td>
    </tr>
 
    </table>

    <input type="hidden" name="uid" id="edit_userid" value= <?php echo ($_SESSION['uid']); ?>>
<!--     <input type="hidden" name="author" id="author" value= <?php echo ($_SESSION['uname']); ?>> -->
    <input type="hidden" name="nickname" id="edit_nickname" value= <?php echo ($_SESSION['unickname']); ?>>
    </form>

</div>

<div id="dlg-add">
    <div class="tool_tip">添加记录后会在列表中出现！！</div>
    <a href="#" id="addok" class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
        onclick="edit_zds()">确认</a>
    <a href="#" class="easyui-linkbutton"
        data-options="iconCls:'icon-cancel'"
        onclick="javascript:$('#editZds').dialog('close')">取消</a>
</div>
<script type="text/javascript">
$(function(){
var cj = $('#cj_add').combobox({ 
    valueField:'id', 
    url: '/solve/index.php/Admin/Trem/cjList', 
    textField:'title', 
    editable:false,
    onSelect: function(rec){    
        $('#gw_add').combogrid({    
        panelWidth:350,    
        idField:'title',    
        textField:'title',
        multiple:true,
        striped: true,    
        url:'/solve/index.php/Admin/Trem/cjList?pid='+rec.id,    
        columns:[[    
            {field:'title',title:'名称',width:120}  
        ]]    
        }); 
        }
     }); 
var gw = $('#cj_edit').combobox({ 
        valueField:'id', 
        url: '/solve/index.php/Admin/Trem/cjList', 
        textField:'title', 
        editable:false,
        onSelect: function(rec){    
            $('#gw_edit').combogrid({    
                panelWidth:350,    
                idField:'title',    
                textField:'title',
                multiple:true,
                striped: true,    
                url:'/solve/index.php/Admin/Trem/cjList?pid='+rec.id,    
                columns:[[    
                    {field:'title',title:'名称',width:120}  
                ]]    
            }); 
        }
     }); 


var searchCj=$('#f_cj').combobox({ 
    valueField:'id', 
    url: '/solve/index.php/Admin/Trem/cjList', 
    textField:'title', 
    editable:true,
    onSelect: function(rec){    
        $('#f_gw').combogrid({    
        panelWidth:130,    
        idField:'title',    
        textField:'title',
        multiple:false,
        striped: true,    
        url:'/solve/index.php/Admin/Trem/cjList?pid='+rec.id,    
        columns:[[    
            {field:'title',title:'名称',width:120}  
        ]]    
        }); 
        }
     }); 
});

  $('#fz').combogrid({   
        
        panelWidth:640,    
        idField:'dc',    
        textField:'dc',
        multiple:true,
        delay: 500,
    mode: 'remote',
        striped: true,    
        url:'/solve/index.php/Admin/Trem/fzhList',    
        columns:[[    
            {field:'zc',title:'总成',width:120},
            {field:'dc',title:'dc',width:60},
            {field:'fzname',title:'分组名称',width:180},
            {field:'sm',title:'分组主要零部件',width:200},
            {field:'fzr',title:'负责人',width:80}  
        ]] ,
        fitColumns: true    
        });
  $('#fz_edit').combogrid({
   
        panelWidth:640,    
        idField:'dc',    
        textField:'dc',
        multiple:true,
        delay: 500,
    mode: 'remote',
        striped: true,    
        url:'/solve/index.php/Admin/Trem/fzhList',    
        columns:[[    
            {field:'zc',title:'总成',width:120},
            {field:'dc',title:'dc',width:60},
            {field:'fzname',title:'分组名称',width:180},
            {field:'sm',title:'分组主要零部件',width:200},
            {field:'fzr',title:'负责人',width:80}  
        ]],
        fitColumns: true  
        });
    $('#ffz_edit').combogrid({
   
        panelWidth:640,    
        idField:'dc',    
        textField:'dc',
        multiple:false,
        delay: 500,
    mode: 'remote',
        striped: true,    
        url:'/solve/index.php/Admin/Trem/fzhList',    
        columns:[[    
            {field:'zc',title:'总成',width:120},
            {field:'dc',title:'dc',width:60},
            {field:'fzname',title:'分组名称',width:180},
            {field:'sm',title:'分组主要零部件',width:200},
            {field:'fzr',title:'负责人',width:80}  
        ]],
        fitColumns: true  
        });




</script>
<script type="text/javascript">
	$('#zds_my_dg').datagrid({
	url : '/solve/index.php/Home/Zds/readmy',
	toolbar : '#myzdstool',
	pagination : true,
	fit : true,
	width : function() {
		return document.body.clientWidth * 0.9
	},
	nowrap : true,
	collapsible : true,
	fitColumns : true,
	autoRowHeight : false,
	striped : true,//交替行
	singleSelect : true,//只允许选择一行
	rownumbers : true,
	border : false,
	sortName : 'id',
	sortOrder : 'desc',//倒序排列
	remoteSort : false,
	pageSize : 30,
	method : 'post',
	pageList : [ 10, 15, 30, 40, 50, 100, 200 ,500,1000],
	columns : [ [
			{
				field : 'id',
				checkbox : true
			},
			{
				field : 'ids',
				title : '编号',
				width : 240
			},
			{
				field : 'title',
				title : '名称',
				width : 400
			},
			{
				field : 'cj',
				title : '车间',
				width : 60
			},
			{
				field : 'gw',
				title : '工位',
				width : 150,
				align : 'center'
			}, {
				field : 'cx',
				title : '适用车型/配置',
				width : 160,
				align : 'left'
			},  {
				field : 'fz',
				title : '分组',
				width : 160,
				align : 'left'
			}, 
			{
				field : 'nickname',
				title : '作者',
				width : 100,
				align : 'left'
				
			},
			{
				field : 'uid',
				title : 'uid',
				width : 100,
				align : 'left',
				hidden : 'true'
				
			}, 
			{
				field : 'date',
				title : '创建日期',
				width : 130	
			},
			{
				field : 'url',
				title : '下载',
				hidden : 'true'			
			}
] ],
	  onDblClickRow: function (rowIndex, rowData) { 
	  	viewZds();
	  }


});

	$('#search_zds_box').searchbox({
		searcher : function(value, name) {
			var queryParams=$("#zds_my_dg").datagrid('options').queryParams;
			queryParams[name]=value;
			$("#zds_my_dg").datagrid('options').queryParams = queryParams;
			$("#zds_my_dg").datagrid("load");
		},
		menu : '#mm_zds',
		prompt : '请输入搜索内容'
	});
// 显示添加指导书窗口
function show_add_zds(){
  var tab = $('#tab').tabs('getSelected'); 
//encodeURI() 函数可把字符串作为 URI 进行编码
tab.panel('refresh', '/solve/index.php/Home/Zds/showadd');

      
}

function add_zds(){
	// 上传前再验证一下，看在上传期间有没有人使用了这个编号
var ids=$('#ids').textbox('getValue');	


var msg='您慢了一步，在填写期间编号“'+ids+'”已经被使用,请点工具栏击刷新按钮重新获得新的编号！';
	$.post('/solve/index.php/Home/Zds/bianhao', function(data) {
							if (data.ids!=ids) {
							$.messager.alert('添加作业指导书', msg, 'info');
							}else{
									$('#add_zds_form').form('submit', {

			url : '/solve/index.php/Home/Zds/add',

			success : function(data) {
				var data = eval('(' + data + ')');
				$('#add_zds').dialog('close');
				$("#zds_my_dg").datagrid("reload");
				$.messager.alert('添加作业指导书', data.data, 'info');
			}
		});
							}

						
						}, 'json');



	


}

// 重新获得ids
function reset_ids() {
	$.post('/solve/index.php/Home/Zds/bianhao', function(data) {
							if (data) {
								$('#add_zds_form').form('load', {

					ids:data.ids

				});

							}

						
						}, 'json');
	// body...
}
function dele_zds(){
		var row = $('#zds_my_dg').datagrid("getSelected");
		var group_id="<?php echo ($_SESSION['group_id']); ?>".split(",");
		
			if ($.inArray("1", group_id)!=-1 || $.inArray("2", group_id)!=-1)  {
			if (row) {
				$.messager.confirm('确认', '您确定要删除此作业与指导书吗?', function(r) {
					if (r) {
						$.post('/solve/index.php/Home/Zds/del', {
							id : row.id
						}, function(data) {
							if (data.status==1) {
								$.messager.alert('删除项目', data.data, 'info');
								$("#zds_my_dg").datagrid("reload");
							} else {
								$.messager.show({ // show error message  
									title : '错误',
									msg : data.data
								});

							}
						}, 'json');
					}
				});
			} else {
				$.messager.alert("请选择", "请选择要删除的作业指导书！", "info");
			}
			} else {

			$.messager.alert("无法删除", "此作业指导书非您创建，无法删除！", "info");
		}
}
function show_edit_zds(){
	var row = $('#zds_my_dg').datagrid("getSelected");
	// console.log(row);
	var group_id="<?php echo ($_SESSION['group_id']); ?>".split(",");
	
	if (row) {

		
	if (row.uid == "<?php echo ($_SESSION[ 'uid']); ?>" || $.inArray("1", group_id)!=-1 || $.inArray("2", group_id)!=-1)  {
  	var tab = $('#tab').tabs('getSelected'); 
//encodeURI() 函数可把字符串作为 URI 进行编码
	tab.panel('refresh', '/solve/index.php/Home/Zds/showedit?id='+row.id);


		// $("#editZds_form").form("load", row);

		// // $('#fz_edit').combogrid('setValue', row.fz);
		// $('#fz_edit').combogrid('setValues', row.fz);



        // gw_edit载入数据
        // $('#gw_edit').combogrid('setValues', row.gw.split(","));
	} else {
			$.messager.alert("无法编辑", "此作业指导书非您创建，无法编辑！", "info");
	}
	} else {

	
		$.messager.alert("请选择要编辑的行", "请选择要编辑的行！", "info");
	}
}
function show_edit_zds1(){
	var row = $('#zds_my_dg').datagrid("getSelected");
	var group_id="<?php echo ($_SESSION['group_id']); ?>".split(",");
			
	if (row.uid == "<?php echo ($_SESSION[ 'uid']); ?>" || $.inArray("1", group_id)!=-1 || $.inArray("2", group_id)!=-1)  {
	if (row) {

		$("#editZds").dialog("open").dialog('setTitle', '&nbsp;&nbsp;编辑作业指导书');
		$("#urlspan").html('');



		$("#editZds_form").form("load", row);

		// $('#fz_edit').combogrid('setValue', row.fz);
		$('#fz_edit').combogrid('setValues', row.fz);


if(row.url!=''){
	var oldurl='<input  id="old_url"  style="width:650px;">';

	$('#urlspan').append(oldurl);
	$("#old_url").textbox({
			buttonText:'删除',
			iconCls:'icon-man',
			iconAlign:'right',
			onClickButton:function(){
				  $.messager.confirm('确认', '您确定要删除并重新上传新的作业指导书文件吗?', function(r) {
                    if (r) {
                        $.post('/solve/index.php/Home/Zds/delPdf', {
                             url : row.url,id : row.id
                        }, function(data) {
                            if (data.status==1) {                                                               
                                $("#urlspan").html('');
                                // $('#edit_ids').textbox('setValue',"");
                                $('#edit_title').textbox('setValue',"");

                                if($('#newUrl').length>0){
                                
                                }else{
                                		var newUrl="<input name='url' type='text' id='newUrl'/>";

                                $('#urlspan').append(newUrl);
                                // $("input#old_url").attr("name",'url');
                                $('#newUrl').filebox({    
                                    buttonText: '选择作业指导书文件', 
                                    buttonAlign: 'right',
                                    buttonIcon:'icon-add',
                                    accept:'application/pdf',
                                    width:'650px',
                                    prompt:'请选择PDF格式的作业指导书文件',
                                    onChange:function(){
								         addEditFile();
								    }

                                })
                                }
                                
                                 $.messager.alert('删除项目', data.data, 'info');
                                
                                
                            } else {
                                $.messager.show({ // show error message  
                                    title : '错误',
                                    msg : data.data
                                });

                            }
                        }, 'json');
                    }
                });
			}
		})
		//拼接url显示框数据
		$("#old_url").textbox('setText',row.title+'（'+row.url+'）');
}else{
		var newUrl="<input name='url' type='text' id='newUrl'/>";

                                $('#urlspan').append(newUrl);
                                // $("input#old_url").attr("name",'url');
                                $('#newUrl').filebox({    
                                    buttonText: '选择作业指导书文件', 
                                    buttonAlign: 'right',
                                    buttonIcon:'icon-add',
                                    accept:'application/pdf',
                                    width:'650px',
                                    prompt:'请选择PDF格式的作业指导书文件',
                                    onChange:function(){
								         addEditFile();
								    }

                                })
}
		

		

		// 初始化cj_edit
		var pid=$('#cj_edit').combobox('getValue');

        $('#gw_edit').combogrid({    
		    panelWidth:350,    
		    idField:'title',    
		    textField:'title',
			multiple:true,
		    striped: true,    
		    url:'/solve/index.php/Admin/Trem/cjList?pid='+pid,    
		    columns:[[    
		        {field:'title',title:'名称',width:120}  
		    ]]    
		});
        // gw_edit载入数据
        $('#gw_edit').combogrid('setValues', row.gw.split(","));
	} else {
		$.messager.alert("请选择要编辑的行", "请选择要编辑的行！", "info");
	}
	} else {

		$.messager.alert("无法删除", "此作业指导书非您创建，无法编辑！", "info");
	}
}


function edit_zds(){
		$('#editZds_form').form('submit', {
			type:'POST',
			 url : '/solve/index.php/Home/Zds/edit',
			success : function(data) {
				var data = eval('(' + data + ')');
				$('#editZds').dialog('close');
				$("#zds_my_dg").datagrid("reload");
				$.messager.alert('编辑作业指导书', data.data, 'info');
				// 

			}
		});
}


 function getFileExt(str) 
{ 
var d=/\.[^\.]+$/.exec(str); 
return d; 
}
$('#zds_url').filebox({
    onChange:function(){
         addFile();
    }
});

function addFile(){
    var filename=$('#zds_url').filebox('getText');
      $('#title').textbox('setValue',filename);
    var fileExt=getFileExt(filename);
    if(fileExt!='.pdf'){
        $.messager.alert("格式错误", "上传的不是pdf文件", "info");
        return false;
    }
     // var ids=/\d{4}[TZE]{2,3}[(（]{1}艺{1}[）)]{1}-\d{5}/.exec(filename);//2017TZE
     //    if(ids==null){
            
     //        $('#ids').textbox('setValue',"");
            
         
     //        $.messager.alert("格式错误", "编号错误", "info");
     //     return false; 
     //    }else{
            
     //        $('#ids').textbox('setValue',ids);
        // }
        //  var title=/-[(（]{1}[\s\S]+\./.exec(filename);//2017TZE
        // if(title==null){
           
           
        //   $('#title').textbox('setValue',"");
            
        //     $.messager.alert("格式错误", "文件名错误", "info");
        //  return false; 
        // }else{
        //     var title=title[0].substr(2,title[0].length-4);
        //     $('#title').textbox('setValue',title);
        // }
   
}


$('#new_url').filebox({
    onChange:function(){
         var filename=$('#new_url').filebox('getText');
          $('#edit_title').textbox('setValue',filename);
          var fileExt=getFileExt(filename);
    if(fileExt!='.pdf'){
        $.messager.alert("格式错误", "上传的不是pdf文件", "info");
        return false;
    }
    }
});


function addEditFile(){
    var filename=$('#newUrl').filebox('getText');
    
    var fileExt=getFileExt(filename);
    if(fileExt!='.pdf'){
        $.messager.alert("格式错误", "上传的不是pdf图文件", "info");
        return false;
    }
     // var ids=/\d{4}[TZE]{2,3}[(（]艺{1}[）)]{1}-\d{5}/.exec(filename);//2017TZE
     //    if(ids==null){
            
     //        $('#edit_ids').textbox('setValue',"");
            
         
     //        $.messager.alert("格式错误", "编号错误", "info");
     //     return false; 
     //    }else{
            
     //        $('#edit_ids').textbox('setValue',ids);
     //    }
     //     var title=/-[(（]{1}[\s\S]+\./.exec(filename);//2017TZE
     //    if(title==null){
           
           
     //      $('#title').textbox('setValue',"");
            
     //        $.messager.alert("格式错误", "文件名错误", "info");
     //     return false; 
     //    }else{
     //        var title=title[0].substr(2,title[0].length-4);
     //        $('#edit_title').textbox('setValue',title);
     //    }
   
}
function viewZds(){

    var row = $('#zds_my_dg').datagrid("getSelected");
        if (row) {
          
                          // 获取当前tab
    var tab = $('#tab').tabs('getSelected'); 
//encodeURI() 函数可把字符串作为 URI 进行编码
    tab.panel('refresh', '/solve/index.php/Home/Zds/view?id='+encodeURI(row.id));

        } else {
            $.messager.alert("请选择", "请选择要查看的作业指导书", "info");
        }
}
function reloadZds(){
	$("#zds_my_dg").datagrid("reload", {   
		    cx: '' 
		});
}
function finaSearchZds(){
	$("#finaBoxZds").slideToggle(function(){
	 	if($('#finaZdsBtn').linkbutton("options").text=="显示高级搜索"){
		 	$('#finaZdsBtn').linkbutton({    
	    		text: '隐藏高级搜索'   
			}); 
	 	}else{
	 		 $('#finaZdsBtn').linkbutton({    
    			text: '显示高级搜索'   
			}); 
	 	}
	});
}
 function finaZds(){
 	// var gws=$("input[name='gws[]']");

 	// var gwArr=new Array();
 	// for(var i=0;i<gws.length;i++){
 	// 	gwArr[i]=gws[i].value;
 	// }

// if($('#f_gw')){
// 	gw=$('#f_gw').val()
// }else{
// 	gw="";
// }

 	$('#zds_my_dg').datagrid('load',{
		ids:$("#f_ids").val(),
		title:$("#f_title").val(),
		cj:$('#f_cj').combobox('getValue'),
		gw:$('#f_gw').combobox('getValue'),
		fz:$('#ffz_edit').combobox('getValue'),
		cx:$("#f_cx").val(),
		nickname:$("#f_nickname").val(),
		dates:$("#f_creatdates").datebox('getValue'),
		datee:$("#f_creatdatee").datebox('getValue')
	});

}
</script>